//
//  ShareNet.m
//  SportSocial
//
//  Created by yull on 15/4/21.
//  Copyright (c) 2015年 hfy. All rights reserved.
//

#import "ShareNet.h"

@implementation ShareNet

+ (AFHTTPRequestOperation *)shareWithImage:(NSData *)imageData
                              successBlock:(httpSuccessBlock)successBlock
                                 failBlock:(httpFailBlock)failBlock
{
    NSString *url = [[NSString alloc] initWithFormat:@"%@/share/file_upload/uploadImage?token=%@",[self baseUrl], [self token]];
    
    AFHTTPRequestOperation *operation = [[self manager] POST:url parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
        [formData appendPartWithFileData:imageData name:@"photo" fileName:@"photo.jpg" mimeType:@"multipart/form-data"];
    } success:successBlock failure:failBlock];
    
    return operation;
}

@end
